{% extends "base.html" %}

{% block content %}
	<div class="section">
    	<h3>Preview New Library</h3>

		<form method="POST" class="form" id="form">
		<input type="hidden" name="title" id="title" value="{{title}}" />
		<input type="hidden" name="link" value="{{link}}" />
		<input type="hidden" name="missing" value="{{missing}}" />
		<input type="hidden" name="have" value="{{have}}" />
		<input type="hidden" name="dont" value="{{dont}}" />
		{% if error %}
		<input type="hidden" id="error" value="{{error}}" />
		{% endif %}
		{% if success %}
		<input type="hidden" id="success" value="{{success}}" />
		{% endif %}
		<table class="preview">
			<tr><td>
				<dl>
					<dt>Library Title:</dt>
					<dd>{{title}}</dd>
					<dt>Link:</dt>
					<dd>{{link}}</dd>
					<dt>Query Results Interpretation:</dt>
					{% if not match_isbn %}
					<dd>"{{missing}}" returned when book not found</dd>
					{% else %}
					<dd>ISBN is returned when book is found</dd>
					{% endif %}
				</dl>
			</td>
			<td>
				<dl>
					<dt>ISBN of an existing book:</dt>
					<dd><a href="{{haveUrl}}" target="_blank">{{have}}</a></dd>
					<dt>ISBN of a missing book:</dt>
					<dd><a href="{{dontUrl}}" target="_blank">{{dont}}</a></dd>
				</dl>
			</td></tr>
			<tr><td colspan="2">
{% if success %}			
				<button id="edit" name="edit" value="Edit another Library">Edit Another Library</button>
{% else %}
				<button type="button" class="button" id="edit" name="edit" value="Make Changes">Edit Library Configuration</button>
{% endif %}
			</td></tr>
		</table>

		<pre class="test-results hidden"></pre>

{% if can_submit %}		
		<div id="submit-panel" class="hidden">		
		
		{{captcha_html|safe}}

		<button type="submit" class="button" id="save" name="save" value="Save Library Configuration">Save Library Configuration</button>
		
		</div>
{% endif %}

    	<pre>{{debug}}</pre>

    	</form>
    </div>
{% endblock %}

{% block html_body_end %}
<script src="/assets/js/sites.js"></script>
<script src="/assets/js/contribute-preview.js"></script>
{% endblock %}